# Author:Yiye
# -*- codeing = utf-8 -*-
# @Time :2021/11/11 16:14
# @Author:李卓
# @Site :
# @File : douban.py
# @Software : PyCharm
import urllib.request
import urllib.parse

from pythonbug.redispool import redisUtils

url = 'https://movie.douban.com/j/search_subjects?type=movie&tag=%E7%83%AD%E9%97%A8&sort=recommend&page_limit=20&page_start=0'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36'
}
request = urllib.request.Request(url=url,headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode('utf8')
print(type(content))
# fp = open('douban.json','w',encoding='utf-8')
# fp.write(content)
r = redisUtils('47.94.155.194',6379,'java_redis_dev@password')
# r.set_key_value('douban',content)
#print(n)
#print(r.get_value('douban'))